package cn.yz.result;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 响应码枚举
 */
@Getter
@AllArgsConstructor
public enum ResultCode {

    SUCCESS(200, "操作成功"),
    ERROR(500, "操作失败"),
    VALIDATE_FAILED(400, "参数检验失败"),
    UNAUTHORIZED(401, "暂未登录或token已经过期"),
    FORBIDDEN(403, "没有相关权限"),
    NOT_FOUND(404, "请求的资源不存在"),
    METHOD_NOT_ALLOWED(405, "请求方法不允许"),
    CONFLICT(409, "请求冲突"),
    TOO_MANY_REQUESTS(429, "请求过于频繁"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),

    // 用户相关错误码
    USER_NOT_FOUND(1001, "用户不存在"),
    USERNAME_OR_PASSWORD_ERROR(1002, "用户名或密码错误"),
    USER_ALREADY_EXISTS(1003, "用户已存在"),
    USER_ACCOUNT_DISABLED(1004, "用户账户已被禁用"),
    USER_ACCOUNT_LOCKED(1005, "用户账户已被锁定"),
    USER_ACCOUNT_EXPIRED(1006, "用户账户已过期"),
    USER_CREDENTIALS_EXPIRED(1007, "用户凭证已过期"),
    USER_INSUFFICIENT_PRIVILEGES(1008, "用户权限不足"),

    // 账单相关错误码
    BILL_NOT_FOUND(2001, "账单不存在"),
    BILL_CATEGORY_NOT_FOUND(2002, "账单分类不存在"),
    BILL_AMOUNT_INVALID(2003, "账单金额无效"),
    BILL_DATE_INVALID(2004, "账单日期无效"),

    // 预算相关错误码
    BUDGET_NOT_FOUND(3001, "预算不存在"),
    BUDGET_AMOUNT_INVALID(3002, "预算金额无效"),
    BUDGET_EXCEEDED(3003, "预算已超支"),
    BUDGET_PERIOD_INVALID(3004, "预算周期无效"),

    // 攒钱计划相关错误码
    SAVING_PLAN_NOT_FOUND(4001, "攒钱计划不存在"),
    SAVING_AMOUNT_INVALID(4002, "攒钱金额无效"),
    SAVING_TARGET_INVALID(4003, "攒钱目标无效"),
    SAVING_PERIOD_INVALID(4004, "攒钱周期无效"),

    // 系统相关错误码
    SYSTEM_ERROR(9001, "系统错误"),
    DATABASE_ERROR(9002, "数据库错误"),
    REDIS_ERROR(9003, "Redis错误"),
    NETWORK_ERROR(9004, "网络错误"),
    FILE_UPLOAD_ERROR(9005, "文件上传错误"),
    FILE_DOWNLOAD_ERROR(9006, "文件下载错误"),
    FILE_NOT_FOUND(9007, "文件不存在"),
    FILE_SIZE_EXCEEDED(9008, "文件大小超限"),
    FILE_TYPE_NOT_ALLOWED(9009, "文件类型不允许");

    private final Integer code;
    private final String message;
} 